package com.theta.gateway.infra.common.config;

import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;



/**
 * apollo常量配置
 * @author theta
 * @date 2020年11月11日
 */
@RefreshScope
@Slf4j
@Getter
@Component
public class NacosConstantConfig {
	
	@Value("${spring.profiles.active}")
	private String profileActive;
	
	/**
	 * 应用名
	 */
	@Value("${spring.application.name}")
	private String serviceId;
	
	
	@Value("${sso.client.appKey:}")
	private String ssoAppKey;
	
	@Value("${sso.client.appSecret:}")
	private String ssoAppSecret;
	
	@Value("${sso.authentication.tokenName:token}")
	private String ssoTokenName;
	@Value("${sso.authentication.cookieName:CLOUD_TOKEN}")
	private String ssoCookieName;
	
	/**
	 * 用户端sso登陆地址
	 */
	@Value("${sso.authentication.user.loginUrl:}")
	private String ssoUserLoginUrl;
	/**
	 * 租户端sso登陆地址
	 */
	@Value("${sso.authentication.tenant.loginUrl:}")
	private String ssoTenantLoginUrl;
	
	
	/**
	 * -自定义请求headers-放在请求头中
	 */
	@Value("${sso.authentication.request-headers:X-Hades-Env-Identity}")
	private String requestHeaders;
	
	/**
	 * -sso相关日志打印开关
	 */
	@Value("${sso.authentication.sso-log.debug:false}")
	private Boolean ssoLogDebug;
	
	
	

   
    
    @PostConstruct
    public void init() {
    	log.info("init NacosConstantConfig  {}",this.profileActive);
		log.info("init NacosConstantConfig appKey {}",this.ssoAppKey);
	}
    
    
   
}
